package com.qingcloud.adminbackend.entity.source;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * <p>
 * 数据源
 * </p>
 *
 * @author wangjinnan
 * @since 2021-03-17
 */
@Getter
@Setter
@ToString
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DataSource implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 数据源名称
     */
    private String name;

    /**
     * 数据源类型 1-数据库
     */
    private Integer type;

    /**
     * 创建时间
     */
    private String createDt;

    /**
     * 项目id
     **/
    private String projectId;

    /**
     * 项目id
     **/
    private String projectName;

    public static String check(DataSource dataSource) {
        if (dataSource == null)
            return "对象不能为空";
        if (dataSource.getProjectId() == null)
            return "projectId参数不能为空";
        if (dataSource.getType() == null)
            return "type参数不能为空";
        if (dataSource.getName() == null)
            return "name参数不能为空";
        return "true";
    }

}
